package net.sky.oa.test.dao.system;

import java.util.Date;
import java.util.List;

import javax.annotation.Resource;

import net.sky.oa.dao.system.SysLogingDao;
import net.sky.oa.model.SysLoging;
import net.sky.oa.test.BaseTestCase;

import org.junit.Test;
import org.springframework.test.annotation.Rollback;

public class SysLogingDaoTestCase extends BaseTestCase {

	@Resource
	private SysLogingDao sysLogingDao;

	@Test
	@Rollback(false)
	public void add() {
		SysLoging sysLoging = new SysLoging();
		sysLoging.setLoginname("LogingName");
		sysLoging.setLogintime(new Date());
		sysLoging.setLogouttime(new Date());
		sysLoging.setLoginip("192.168.210.254");
		this.sysLogingDao.save(sysLoging);
	}

	@Test
	@Rollback(false)
	public void find() {

		List<SysLoging> logings = this.sysLogingDao.findAllLoging();
		for (SysLoging loging : logings) {
			System.out.println("getLoginname:" + loging.getLoginname());
		}
	}
}